package com.foreknow.ex.oop;

/*
* 构造器的重载(Overload):在调用构造器的时候会根据传入的参数决定调用哪一个构造器
* */
public class OverloadDemo {
    public OverloadDemo(){
        System.out.println("1111111111");
    }

    public OverloadDemo(int a){
        System.out.println(a);
    }
    public OverloadDemo(String s,double d){
        System.out.println(s);
    }


    //方法重载
    public  int add(int a,int b){
        return a+b;
    }

    public  int add(int a,int b,int c){
        return a+b+c;
    }

    public static void main(String[] args) {
        OverloadDemo overloadDemo = new OverloadDemo("abc",3.14);

    }


}
